//
//  KTChooseRootVC.m
//  KTLotteryTicket
//
//  Created by CoolKi on 16/3/7.
//  Copyright © 2016年 CoolKi. All rights reserved.
//

#import "KTChooseRootVC.h"
#import "KTDataTool.h"

#import "KTRootTabBarC.h"
#import "KTNewFetureCVC.h"


#define SavedVersion @"savedVersion"

@implementation KTChooseRootVC

+ (UIViewController *)chooseRootViewController{
    
    //获取当前软件版本号
    NSString * currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
    
    //获取之前存储的版本号
    NSString * savedVersion = (NSString*)[KTDataTool objectForKey:SavedVersion];
    
    //NSLog(@"%@-%@",currentVersion,savedVersion);
    //[savedVersion isEqualToString:currentVersion]
    if ([savedVersion isEqualToString:currentVersion]) {
        KTRootTabBarC * rootTabBarVC = [[KTRootTabBarC alloc]init];
        return rootTabBarVC;
    }else{
        KTNewFetureCVC * newFuture = [[KTNewFetureCVC alloc]init];
        [KTDataTool setObject:currentVersion forKey:SavedVersion];
        return newFuture;
    }
    
    
    return nil;
}

@end
